<template>
  <ContentWrap>
    <!-- 搜索工作栏 -->
    <el-form
      class="-mb-15px"
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="订单保存后自动审核" prop="autoApproveOrder">
        <el-select
          v-model="queryParams.autoApproveOrder"
          placeholder="请选择订单保存后自动审核"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="订单在审核状态下可直接修改" prop="allowEditApprovedOrder">
        <el-select
          v-model="queryParams.allowEditApprovedOrder"
          placeholder="请选择订单在审核状态下可直接修改"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="系统数据备份路径" prop="dataBackupPath">
        <el-input
          v-model="queryParams.dataBackupPath"
          placeholder="请输入系统数据备份路径"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="排产提醒默认到交期天数" prop="defaultScheduleWarningDays">
        <el-input
          v-model="queryParams.defaultScheduleWarningDays"
          placeholder="请输入排产提醒默认到交期天数"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="算料规则" prop="materialCalculateRule">
        <el-select
          v-model="queryParams.materialCalculateRule"
          placeholder="请选择算料规则"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.PAPER_CARD_TYPE)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="是否按模切规格计算材料" prop="useDieCutSpecForMaterialCalc">
        <el-select
          v-model="queryParams.useDieCutSpecForMaterialCalc"
          placeholder="请选择是否按模切规格计算材料"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="供应商报价策略" prop="supplierQuotePolicy">
        <el-select
          v-model="queryParams.supplierQuotePolicy"
          placeholder="请选择供应商报价策略"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_SUPPLIER_OFFER)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="净板约宽最小值" prop="minBoardWidth">
        <el-input
          v-model="queryParams.minBoardWidth"
          placeholder="请输入净板约宽最小值"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="原料采购是否按供应商" prop="directSupplierRawMaterial">
        <el-select
          v-model="queryParams.directSupplierRawMaterial"
          placeholder="请选择原料采购是否按供应商"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="辅料采购是否按供应商" prop="directSupplierAuxiliaryMaterial">
        <el-select
          v-model="queryParams.directSupplierAuxiliaryMaterial"
          placeholder="请选择辅料采购是否按供应商"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="纸板采购默认交货天数" prop="defaultPaperboardDeliveryDays">
        <el-input
          v-model="queryParams.defaultPaperboardDeliveryDays"
          placeholder="请输入纸板采购默认交货天数"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="采购单价为0不允许保存" prop="preventZeroPriceOrder">
        <el-select
          v-model="queryParams.preventZeroPriceOrder"
          placeholder="请选择采购单价为0不允许保存"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="客户报价策略" prop="customerQuotePolicy">
        <el-select
          v-model="queryParams.customerQuotePolicy"
          placeholder="请选择客户报价策略"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_SUPPLIER_OFFER)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="纸箱订单默认交货天数" prop="defaultDeliveryDaysBox">
        <el-input
          v-model="queryParams.defaultDeliveryDaysBox"
          placeholder="请输入纸箱订单默认交货天数"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="彩印订单默认交货天数" prop="defaultDeliveryDaysColorBox">
        <el-input
          v-model="queryParams.defaultDeliveryDaysColorBox"
          placeholder="请输入彩印订单默认交货天数"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="销售订单保存后自动审核" prop="autoApproveSalesOrder">
        <el-select
          v-model="queryParams.autoApproveSalesOrder"
          placeholder="请选择销售订单保存后自动审核"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="不入库可以开送货单" prop="allowNonStockDelivery">
        <el-select
          v-model="queryParams.allowNonStockDelivery"
          placeholder="请选择不入库可以开送货单"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="送货需按排程发货" prop="enableSchedulingDelivery">
        <el-select
          v-model="queryParams.enableSchedulingDelivery"
          placeholder="请选择送货需按排程发货"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="送货单车量超容量提醒" prop="carOvercapacityWarning">
        <el-select
          v-model="queryParams.carOvercapacityWarning"
          placeholder="请选择送货单车量超容量提醒"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="系统月结日" prop="systemMonthEnd">
        <el-input
          v-model="queryParams.systemMonthEnd"
          placeholder="请输入系统月结日"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="原料入库限制" prop="rawMaterialInLimit">
        <el-select
          v-model="queryParams.rawMaterialInLimit"
          placeholder="请选择原料入库限制"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_MATERIAL_WARE_IN_LIMIT)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="成品入库限制" prop="productInLimit">
        <el-select
          v-model="queryParams.productInLimit"
          placeholder="请选择成品入库限制"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_PRODUCT_WARE_IN_LIMIT)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="成品送货提示" prop="productDeliveryHint">
        <el-select
          v-model="queryParams.productDeliveryHint"
          placeholder="请选择成品送货提示"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_PRODUCT_DELIVERY_ALERT)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="产品默认单位" prop="defaultProductUnit">
        <el-select
          v-model="queryParams.defaultProductUnit"
          placeholder="请选择产品默认单位"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.DEFAULT_UNIT)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="成品入库限制2" prop="productInLimit2">
        <el-input
          v-model="queryParams.productInLimit2"
          placeholder="请输入成品入库限制2"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="送货单保存后自动审核" prop="deliveryAutoAudit">
        <el-select
          v-model="queryParams.deliveryAutoAudit"
          placeholder="请选择送货单保存后自动审核"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="成品管理模式" prop="productManagementMode">
        <el-select
          v-model="queryParams.productManagementMode"
          placeholder="请选择成品管理模式"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_PRODUCT_MANAGE_MODE)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="成品送货方式" prop="productDeliveryMode">
        <el-select
          v-model="queryParams.productDeliveryMode"
          placeholder="请选择成品送货方式"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_PRODUCT_DELIVERY_MODE)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="送货单自动领用库存或者生成成品" prop="deliveryAutoPickOrProduce">
        <el-select
          v-model="queryParams.deliveryAutoPickOrProduce"
          placeholder="请选择送货单自动领用库存或者生成成品"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="辅料入库限制" prop="auxiliaryMaterialInLimit">
        <el-select
          v-model="queryParams.auxiliaryMaterialInLimit"
          placeholder="请选择辅料入库限制"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_ACCESSORIES_MATERIAL_IN_LIMIT)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="毛利分析成本" prop="profitAnalysisBase">
        <el-select
          v-model="queryParams.profitAnalysisBase"
          placeholder="请选择毛利分析成本"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getStrDictOptions(DICT_TYPE.BASEORDERCONFIG_FINANCE_COST_ANALYSIS)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="启用财务结账" prop="enableFinancialClosing">
        <el-select
          v-model="queryParams.enableFinancialClosing"
          placeholder="请选择启用财务结账"
          clearable
          class="!w-240px"
        >
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="财务结账日期" prop="financialClosingDate">
        <el-date-picker
          v-model="queryParams.financialClosingDate"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="daterange"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
          class="!w-220px"
        />
      </el-form-item>
      <el-form-item label="外协核价规格单位" prop="outsourcingPricingUnit">
        <el-input
          v-model="queryParams.outsourcingPricingUnit"
          placeholder="请输入外协核价规格单位"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="外协采购数量是否取上一道工序的完工数" prop="outsourcingPurchaseQtyUseLastProcess">
        <el-select
          v-model="queryParams.outsourcingPurchaseQtyUseLastProcess"
          placeholder="请选择外协采购数量是否取上一道工序的完工数"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="现场自动打印成品标签" prop="autoPrintProductLabel">
        <el-select
          v-model="queryParams.autoPrintProductLabel"
          placeholder="请选择现场自动打印成品标签"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="生产前是否维护机台" prop="preProductionMaintenance">
        <el-select
          v-model="queryParams.preProductionMaintenance"
          placeholder="请选择生产前是否维护机台"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="触摸屏自动领料" prop="touchscreenAutoPick">
        <el-select
          v-model="queryParams.touchscreenAutoPick"
          placeholder="请选择触摸屏自动领料"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="触摸屏打印自动计算张数" prop="touchscreenAutoPrintCount">
        <el-select
          v-model="queryParams.touchscreenAutoPrintCount"
          placeholder="请选择触摸屏打印自动计算张数"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="触摸屏外协不入库可以看下一道工序" prop="touchscreenOutsourceSkipStorage">
        <el-select
          v-model="queryParams.touchscreenOutsourceSkipStorage"
          placeholder="请选择触摸屏外协不入库可以看下一道工序"
          clearable
          class="!w-240px"
        >
          <el-option
            v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="送货单产品类型" prop="deliveryOrderProductType">
        <el-input
          v-model="queryParams.deliveryOrderProductType"
          placeholder="请输入送货单产品类型"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <el-date-picker
          v-model="queryParams.createTime"
          value-format="YYYY-MM-DD HH:mm:ss"
          type="daterange"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
          class="!w-220px"
        />
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
        <el-button
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['erp:base-order-config:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" /> 新增
        </el-button>
        <el-button
          type="success"
          plain
          @click="handleExport"
          :loading="exportLoading"
          v-hasPermi="['erp:base-order-config:export']"
        >
          <Icon icon="ep:download" class="mr-5px" /> 导出
        </el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>

  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="id" align="center" prop="id" />
      <el-table-column label="订单保存后自动审核" align="center" prop="autoApproveOrder">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.autoApproveOrder" />
        </template>
      </el-table-column>
      <el-table-column label="订单在审核状态下可直接修改" align="center" prop="allowEditApprovedOrder">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.allowEditApprovedOrder" />
        </template>
      </el-table-column>
      <el-table-column label="系统数据备份路径" align="center" prop="dataBackupPath" />
      <el-table-column label="排产提醒默认到交期天数" align="center" prop="defaultScheduleWarningDays" />
      <el-table-column label="算料规则" align="center" prop="materialCalculateRule">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.PAPER_CARD_TYPE" :value="scope.row.materialCalculateRule" />
        </template>
      </el-table-column>
      <el-table-column label="是否按模切规格计算材料" align="center" prop="useDieCutSpecForMaterialCalc">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.useDieCutSpecForMaterialCalc" />
        </template>
      </el-table-column>
      <el-table-column label="供应商报价策略" align="center" prop="supplierQuotePolicy">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_SUPPLIER_OFFER" :value="scope.row.supplierQuotePolicy" />
        </template>
      </el-table-column>
      <el-table-column label="净板约宽最小值" align="center" prop="minBoardWidth" />
      <el-table-column label="原料采购是否按供应商" align="center" prop="directSupplierRawMaterial">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.directSupplierRawMaterial" />
        </template>
      </el-table-column>
      <el-table-column label="辅料采购是否按供应商" align="center" prop="directSupplierAuxiliaryMaterial">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.directSupplierAuxiliaryMaterial" />
        </template>
      </el-table-column>
      <el-table-column label="纸板采购默认交货天数" align="center" prop="defaultPaperboardDeliveryDays" />
      <el-table-column label="采购单价为0不允许保存" align="center" prop="preventZeroPriceOrder">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.preventZeroPriceOrder" />
        </template>
      </el-table-column>
      <el-table-column label="客户报价策略" align="center" prop="customerQuotePolicy">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_SUPPLIER_OFFER" :value="scope.row.customerQuotePolicy" />
        </template>
      </el-table-column>
      <el-table-column label="纸箱订单默认交货天数" align="center" prop="defaultDeliveryDaysBox" />
      <el-table-column label="彩印订单默认交货天数" align="center" prop="defaultDeliveryDaysColorBox" />
      <el-table-column label="销售订单保存后自动审核" align="center" prop="autoApproveSalesOrder">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.autoApproveSalesOrder" />
        </template>
      </el-table-column>
      <el-table-column label="不入库可以开送货单" align="center" prop="allowNonStockDelivery">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.allowNonStockDelivery" />
        </template>
      </el-table-column>
      <el-table-column label="送货需按排程发货" align="center" prop="enableSchedulingDelivery">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.enableSchedulingDelivery" />
        </template>
      </el-table-column>
      <el-table-column label="送货单车量超容量提醒" align="center" prop="carOvercapacityWarning">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.carOvercapacityWarning" />
        </template>
      </el-table-column>
      <el-table-column label="系统月结日" align="center" prop="systemMonthEnd" />
      <el-table-column label="原料入库限制" align="center" prop="rawMaterialInLimit">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_MATERIAL_WARE_IN_LIMIT" :value="scope.row.rawMaterialInLimit" />
        </template>
      </el-table-column>
      <el-table-column label="成品入库限制" align="center" prop="productInLimit">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_PRODUCT_WARE_IN_LIMIT" :value="scope.row.productInLimit" />
        </template>
      </el-table-column>
      <el-table-column label="成品送货提示" align="center" prop="productDeliveryHint">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_PRODUCT_DELIVERY_ALERT" :value="scope.row.productDeliveryHint" />
        </template>
      </el-table-column>
      <el-table-column label="产品默认单位" align="center" prop="defaultProductUnit">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.DEFAULT_UNIT" :value="scope.row.defaultProductUnit" />
        </template>
      </el-table-column>
      <el-table-column label="成品入库限制2" align="center" prop="productInLimit2" />
      <el-table-column label="送货单保存后自动审核" align="center" prop="deliveryAutoAudit">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.deliveryAutoAudit" />
        </template>
      </el-table-column>
      <el-table-column label="成品管理模式" align="center" prop="productManagementMode">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_PRODUCT_MANAGE_MODE" :value="scope.row.productManagementMode" />
        </template>
      </el-table-column>
      <el-table-column label="成品送货方式" align="center" prop="productDeliveryMode">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_PRODUCT_DELIVERY_MODE" :value="scope.row.productDeliveryMode" />
        </template>
      </el-table-column>
      <el-table-column label="送货单自动领用库存或者生成成品" align="center" prop="deliveryAutoPickOrProduce">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.deliveryAutoPickOrProduce" />
        </template>
      </el-table-column>
      <el-table-column label="辅料入库限制" align="center" prop="auxiliaryMaterialInLimit">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_ACCESSORIES_MATERIAL_IN_LIMIT" :value="scope.row.auxiliaryMaterialInLimit" />
        </template>
      </el-table-column>
      <el-table-column label="毛利分析成本" align="center" prop="profitAnalysisBase">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.BASEORDERCONFIG_FINANCE_COST_ANALYSIS" :value="scope.row.profitAnalysisBase" />
        </template>
      </el-table-column>
      <el-table-column label="启用财务结账" align="center" prop="enableFinancialClosing" />
      <el-table-column label="财务结账日期" align="center" prop="financialClosingDate" />
      <el-table-column label="外协核价规格单位" align="center" prop="outsourcingPricingUnit" />
      <el-table-column label="外协采购数量是否取上一道工序的完工数" align="center" prop="outsourcingPurchaseQtyUseLastProcess">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.outsourcingPurchaseQtyUseLastProcess" />
        </template>
      </el-table-column>
      <el-table-column label="现场自动打印成品标签" align="center" prop="autoPrintProductLabel">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.autoPrintProductLabel" />
        </template>
      </el-table-column>
      <el-table-column label="生产前是否维护机台" align="center" prop="preProductionMaintenance">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.preProductionMaintenance" />
        </template>
      </el-table-column>
      <el-table-column label="触摸屏自动领料" align="center" prop="touchscreenAutoPick">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.touchscreenAutoPick" />
        </template>
      </el-table-column>
      <el-table-column label="触摸屏打印自动计算张数" align="center" prop="touchscreenAutoPrintCount">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.touchscreenAutoPrintCount" />
        </template>
      </el-table-column>
      <el-table-column label="触摸屏外协不入库可以看下一道工序" align="center" prop="touchscreenOutsourceSkipStorage">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.touchscreenOutsourceSkipStorage" />
        </template>
      </el-table-column>
      <el-table-column label="送货单产品类型" align="center" prop="deliveryOrderProductType" />
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
      <el-table-column label="操作" align="center" min-width="120px">
        <template #default="scope">
          <el-button
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['erp:base-order-config:update']"
          >
            编辑
          </el-button>
          <el-button
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['erp:base-order-config:delete']"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <Pagination
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </ContentWrap>

  <!-- 表单弹窗：添加/修改 -->
  <BaseOrderConfigForm ref="formRef" @success="getList" />
</template>

<script setup lang="ts">
import { getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { BaseOrderConfigApi, BaseOrderConfigVO } from '@/api/erp/baseorderconfig'
import BaseOrderConfigForm from './BaseOrderConfigForm.vue'

/** ERP基础资料-开单参数系统参数 列表 */
defineOptions({ name: 'BaseOrderConfig' })

const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化

const loading = ref(true) // 列表的加载中
const list = ref<BaseOrderConfigVO[]>([]) // 列表的数据
const total = ref(0) // 列表的总页数
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  autoApproveOrder: undefined,
  allowEditApprovedOrder: undefined,
  dataBackupPath: undefined,
  defaultScheduleWarningDays: undefined,
  materialCalculateRule: undefined,
  useDieCutSpecForMaterialCalc: undefined,
  supplierQuotePolicy: undefined,
  minBoardWidth: undefined,
  directSupplierRawMaterial: undefined,
  directSupplierAuxiliaryMaterial: undefined,
  defaultPaperboardDeliveryDays: undefined,
  preventZeroPriceOrder: undefined,
  customerQuotePolicy: undefined,
  defaultDeliveryDaysBox: undefined,
  defaultDeliveryDaysColorBox: undefined,
  autoApproveSalesOrder: undefined,
  allowNonStockDelivery: undefined,
  enableSchedulingDelivery: undefined,
  carOvercapacityWarning: undefined,
  systemMonthEnd: undefined,
  rawMaterialInLimit: undefined,
  productInLimit: undefined,
  productDeliveryHint: undefined,
  defaultProductUnit: undefined,
  productInLimit2: undefined,
  deliveryAutoAudit: undefined,
  productManagementMode: undefined,
  productDeliveryMode: undefined,
  deliveryAutoPickOrProduce: undefined,
  auxiliaryMaterialInLimit: undefined,
  profitAnalysisBase: undefined,
  enableFinancialClosing: undefined,
  financialClosingDate: [],
  outsourcingPricingUnit: undefined,
  outsourcingPurchaseQtyUseLastProcess: undefined,
  autoPrintProductLabel: undefined,
  preProductionMaintenance: undefined,
  touchscreenAutoPick: undefined,
  touchscreenAutoPrintCount: undefined,
  touchscreenOutsourceSkipStorage: undefined,
  deliveryOrderProductType: undefined,
  createTime: []
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await BaseOrderConfigApi.getBaseOrderConfigPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 重置按钮操作 */
const resetQuery = () => {
  queryFormRef.value.resetFields()
  handleQuery()
}

/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
  formRef.value.open(type, id)
}

/** 删除按钮操作 */
const handleDelete = async (id: number) => {
  try {
    // 删除的二次确认
    await message.delConfirm()
    // 发起删除
    await BaseOrderConfigApi.deleteBaseOrderConfig(id)
    message.success(t('common.delSuccess'))
    // 刷新列表
    await getList()
  } catch {}
}

/** 导出按钮操作 */
const handleExport = async () => {
  try {
    // 导出的二次确认
    await message.exportConfirm()
    // 发起导出
    exportLoading.value = true
    const data = await BaseOrderConfigApi.exportBaseOrderConfig(queryParams)
    download.excel(data, 'ERP基础资料-开单参数系统参数.xls')
  } catch {
  } finally {
    exportLoading.value = false
  }
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>